home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 23
/
Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso
/
Aminet
/
dev
/
misc
/
gms_dev.lha
/
GMSDev
/
Source
/
Asm
/
Cards
/
DrawCardBuffered.s
< prev
Wrap
Text File
|
1997-12-23
|
5KB
|
227 lines
;-------T-------T------------------------T----------------------------------;
;Draw Reko Cards
;---------------
;Loads a reko card file and draws a card to screen. Push right mouse
;button to cycle through the available cards in the file.
INCDIR "INCLUDES:"
INCLUDE "dpkernel/dpkernel.i"
INCLUDE "graphics/cards.i"
INCLUDE "system/modules.i"
SECTION "Demo",CODE
;===========================================================================;
; INITIALISE DEMO
;===========================================================================;
STARTDPK
Start: MOVEM.L A0-A6/D1-D7,-(SP)
move.l DPKBase(pc),a6
lea PictureFile(pc),a0
moveq #ID_PICTURE,d0
CALL Load
move.l d0,Picture
beq .Exit
moveq #ID_SCREEN,d0
CALL Get
move.l d0,Screen
beq .Exit
move.l Picture(pc),a0
move.l Screen(pc),a1
move.l PIC_Bitmap(a0),a2
move.l BMP_Data(a2),GS_MemPtr1(a1)
move.l #DBLBUFFER,GS_Attrib(a1)
CALL CopyStructure
move.l Screen(pc),a0
sub.l a1,a1
CALL Init
tst.l d0
beq.s .Exit
move.l BLTBase(pc),a6
moveq #BUFFER1,d0
moveq #BUFFER2,d1
CALL bltCopyBuffer
;---------------------------------------------------------------------------;
;Initialise the module and cardset.
move.l DPKBase(pc),a6
lea CardModtags(pc),a0
sub.l a1,a1
CALL Init ;>> = Initialise Cards Interface.
move.l d0,CardModule
beq.s .Exit
move.l d0,a0 ;a0 = Card Module.
move.l MOD_ModBase(a0),CardBase ;ma = Store jump table.
lea CardsTag(pc),a0 ;a1 = CardSet.
move.l Screen(pc),a1 ;a0 = Screen.
CALL Init ;>> = Initialise the card set.
tst.l d0
beq.s .Exit
;---------------------------------------------------------------------------;
;Initialise the restorelist.
lea RestoreTags(pc),a0
move.l Screen(pc),a1 ;a1 = Screen.
CALL Init ;>> = Initialise the restore list.
tst.l d0 ;d0 = Check for errors.
beq.s .Exit ;>> = Error, exit.
;---------------------------------------------------------------------------;
moveq #ID_JOYDATA,d0 ;Get joydata structure for reading
CALL Get ;joyports.
move.l d0,JoyData
beq.s .Exit
move.l d0,a0 ;Initialise the joydata structure.
sub.l a1,a1
CALL Init
tst.l d0
beq.s .Exit
;---------------------------------------------------------------------------;
move.l Screen(pc),a0
CALL Display
bsr.s Main
;---------------------------------------------------------------------------;
; EXIT TO DOS
;---------------------------------------------------------------------------;
.Exit move.l DPKBase(pc),a6
move.l JoyData(pc),a0
CALL Free
move.l Restore(pc),a0
CALL Free
move.l CardSet(pc),a0
CALL Free
move.l CardModule(pc),a0
CALL Free
move.l Screen(pc),a0
CALL Free
move.l Picture(pc),a0
CALL Free
MOVEM.L (SP)+,A0-A6/D1-D7
moveq #ERR_OK,d0
rts
;===========================================================================;
; MAIN LOOP
;===========================================================================;
Main:
.loop move.l DPKBase(pc),a6
move.l Restore(pc),a0
CALL Activate
move.l CardSet(pc),a0 ;a0 = Cardset.
CALL Draw ;>> = Draw the card.
move.l SCRBase(pc),a6
CALL scrWaitVBL
move.l Screen(pc),a0
CALL scrSwapBuffers
move.l DPKBase(pc),a6
tst.w Counter
ble.s .query
subq.w #1,Counter
.query move.l JoyData(pc),a0
CALL Query
move.l JoyData(pc),a0
move.l CardSet(pc),a1
move.l CS_Bob(a1),a1
move.w JD_XChange(a0),d0
add.w d0,BOB_XCoord(a1)
move.w JD_YChange(a0),d0
add.w d0,BOB_YCoord(a1)
move.l JD_Buttons(a0),d0
.FlipCards
btst #JB_RMB,d0
beq.s .ChkLMB
tst.w Counter
bgt.s .ChkLMB
move.w #25,Counter
move.l Cardset(pc),a1
addq.w #1,CS_Card(a1)
move.w CS_AmtCards(a1),d1
cmp.w CS_Card(a1),d1
bgt.s .ChkLMB
clr.w CS_Card(a1)
.ChkLMB move.l JoyData(pc),a0
move.l JD_Buttons(a0),d0
btst #JB_LMB,d0
beq .loop
rts
;===========================================================================;
; DATA
;===========================================================================;
Counter: dc.w 0
CardBase: dc.l 0
JoyData: dc.l 0
Screen: dc.l 0
;---------------------------------------------------------------------------;
CardModTags: dc.l TAGS_MODULE
CardModule: dc.l 0
dc.l MODA_Number,MOD_CARDS
dc.l MODA_Version,Cards_ModVersion
dc.l MODA_Revision,Cards_ModRevision
dc.l TAGEND
;---------------------------------------------------------------------------;
RestoreTags: dc.l TAGS_RESTORE
Restore: dc.l 0
dc.l RSA_Entries,1
dc.l TAGEND
;---------------------------------------------------------------------------;
Picture: dc.l 0
PictureFile: FILENAME "GMS:demos/data/background16.iff",0
;---------------------------------------------------------------------------;
CardsTag: dc.l TAGS_CARDSET
CardSet: dc.l 0
dc.l CSA_Attrib,BBF_CLIP|BBF_GENMASK|BBF_FILLMASK|BBF_RESTORE
dc.l CSA_Source,.file
dc.l CSA_BobTags,0
dc.l BBA_XCoord,50
dc.l BBA_YCoord,50
dc.l TAGEND,0
dc.l TAGEND
.file FILENAME "GMS:demos/data/Hires16.reko",0
;===========================================================================;
ProgName: dc.b "Draw Card",0
ProgAuthor: dc.b "Paul Manias",0
ProgDate: dc.b "December 1997",0
ProgCopyright: dc.b "DreamWorld Productions (c) 1996-1997. Freely distributable.",0
ProgShort: dc.b "Simple card demonstration.",0
even